home *** CD-ROM | disk | FTP | other *** search
- From: jbye@acorn.co.uk (James)
- Date: 14 Jul 92 07:33:50 GMT
-
-
- SWI Interface for Joystick Devices
- ----------------------------------
-
- The Joystick module provides a SWI interface for reading the state of a
- joystick. When the module initialises, it tests for the existence of
- built-in joystick hardware and if it does not find any then it will not
- initialise. Third parties can replace this module to provide support for
- different hardware. It is recommended that any such modules have version
- numbers greater than 2.00 so that Acorn can upgrade its own module without
- preventing its replacement.
-
-
- SWI Joystick_Read (SWI &43F40)
- -------------------------------
-
- Returns the state of a joystick.
-
- On entry: R0 = joystick number
-
- On exit: R0 = joystick state
-
- Interrupts: Interrupt status is not altered
-
- Processor mode: Processor is in SVC mode
-
- Re-entrancy: Not defined
-
- Use: This SWI is used to obtain the state of the requested
- joystick. The state is returned in the following
- format:
-
- Byte 0: signed Y value (range -127 to 127)
- -64, 0 or 64 for single switch joystick
- (corresponds to Down, Rest, Up).
-
- Byte 1: signed X value (range -127 to 127)
- -64, 0 or 64 for single switch joystick
- (corresponds to Left, Rest, Right).
-
- Byte 2: Switches (e.g. fire buttons) starting in
- bit 0, unimplemented switches return 0.
-
- Byte 3: Reserved.
-
- Note that this format allows both digital and analogue devices to be
- supported. Applications which are only interested in state (up, down,
- left, right) should not simply test the bytes for positive, negative or
- zero. It is recommended that the 'at rest' state should span a middle
- range, say from -32 to 32 since analogue joysticks cannot be relied upon to
- produce 0 when at rest.
-
-
-
- From: s001532@kowande.bu.oz.au (Jeremy Lee)
- Subject: $10 DIY Joystick interface
- Date: 9 Sep 91 03:40:38 GMT
-
- I had this idea a while ago. The Arc lacks a joystick port and nobody
- wants to fork out #100 for a joystick podule, so how about this alternative.
- It is based on the belief that you don't print while you play games.
-
-
- Joystick 1 Joystick 2
-
- com F1 2 3 U D L R com F1 2 3 U D L R
- o o o o o o o o o o o o o o o o
- | | | | | | | +----+---+-+-+-+-+-+-*
- | | | | | | +------+---+-+-+-+-+-* |
- | | | | | +--------+---+-+-+-+-* | |
- | | | | +----------+---+-+-+-* | | |
- | | | +------------+---+-+-* | | | |
- | | +--------------+---+-* | | | | |
- | +----------------+---* | | | | | |
- | NOT | | | | | | | |
- | +----o<|---*-----*-+-+ | | | | | | |
- | | | | | | | | | | | |
- --- --- | | | | | | | |
- AND| | AND| | | | | | | | | |
- \ / \ / | | | | | | | |
- T T | | | | | | | |
- +------------------* | | | | | | | |
- | | | | | | | | | * Join
- | | | | | | | | |
- | | | | | | | | | + Cross
- +---+ | | | | | | | |
- | | | | | | | | |
- o o o o o o o o o
- *rdy D7 6 5 4 3 2 1 0
-
- Printer Port
-
- Or, for the REAL pennypincher :
-
- Joystick
-
- com F1 2 3 U D L R
- o o o o o o o o
- | | | | | | | |
- | | | | | | | |
- o o o o o o o o
- *rdy D6 5 4 3 2 1 0
-
- Printer Port
-
- Both are compatible (except that it you try to use the single joystick
- version with software that wants two, then the computer will think that both
- joysticks are doing the same thang!
-
-
- Software works like this. D7 chooses which joystick through the gates.
- The program then strobes D0-D6 and looks at the *rdy line. If it is "on" then
- the signal got through and the switch obviously is closed. (It of course, has
- to strobe each switch seperatly, and for each joystick.)
-
- The design here allows for a standard eight-direction joystick and up to three
- fire buttons. A little clever sofware and you're away (anyone want to write it,
- or build it for that matter?)
-
- The only restriction is that it has to use bog-standard switches as the
- computer sends the signals back to other way. Rapid-fire joysticks
- probably won't work (in rapid fire mode) nor will any devices that directly
- drive the pins. (trackballs & extra mice are right out. So are other DIY
- sensor projects that you see in a lot of Mags.)
-
- But, It's cheap and easy to just zap them space invaders.
-
-
- ***********************************************************************
- * /| Jeremy Lee s001532@sand.sics.bu.oz.au I'm Baaaack!... *
- * /_| "Then again, I might just be Insane" *
- * / | "I'm an academic kleptomaniac. I just keep picking things up!" *
- ***********************************************************************
-
-
-